{% extends 'layout.html' %}

{% block content %}
   <div class="container">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">ModelForm方法编辑用户 </h3>
          </div>
          <div class="panel-body">
            <!--加novalidate，去掉浏览器自带的校验提示-->
            <form method="POST" novalidate>
                <!-- post提交默认报错，这里必须加上csrf_token -->
                {% csrf_token %}

                    {% for field in form %}
                        <div class="form-group">
                            <label>{{ field.label }}</label>
                            {{ field }}
                            <span style="color: red;">{{ field.errors.0 }}</span>
                            <!--<input type="text" class="form-control" placeholder="姓名" name="user"/>-->
                        </div>
                        <!-- {{ field.label }} : {{ field }} -->
                    {% endfor %}


              <button type="submit" class="btn btn-primary">提交</button>
            </form>
          </div>
            </div>
        </div>
{% endblock %}